import mockjs from 'mockjs';
import { delay } from 'roadhog-api-doc';
import defaultSettings from '@/defaultSettings';
import { source, target, sourceMessage } from './settings';

//
const proxy = {
  'GET /v1//transform/queryVersionData': (req, res) => {
    res.status(200).send({
      resultCode: '0',
      resultData: {
        versionId: '123',
        sourceFormat: 'JSON',
        sourceMessage: sourceMessage,
        sourceTree: source,
        targetTree: target,
      },
    });
  },

  'GET /v1/transform/listCustomSingleValueTransformers2': (req, res) => {
    res.status(200).send(
      mockjs.mock({
        resultCode: '0',
        'resultData|10-50': [
          {
            title: `@title()`,
            className: '@cword()',
            beanName: 'sampleCustomSingleValueTransformer',
          },
        ],
      })
    );
  },
};

export default delay(proxy, defaultSettings.delay);
